using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.OpenHarmony;

public class demo : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {
    }

    // Update is called once per frame
    void Update()
    {
        gameObject.transform.Rotate(0, Time.deltaTime * 90, 0);
        var angle = gameObject.transform.rotation.eulerAngles;
        if (angle.y > 270)
            gameObject.GetComponent<MeshRenderer>().materials[0].color = Color.magenta;
        else if (angle.y > 180)
            gameObject.GetComponent<MeshRenderer>().materials[0].color = Color.green;
        else if (angle.y > 90)
            gameObject.GetComponent<MeshRenderer>().materials[0].color = Color.yellow;
        else if (angle.y > 0)
            gameObject.GetComponent<MeshRenderer>().materials[0].color = Color.cyan;
    }
}
